import {
	HTTP_REQUEST_URL,
	HEADER,
	TOKENNAME,
	TIMEOUT
} from '@/config/app';
import request from "@/utils/request.js";

// 基础API路径，利用Vite代理配置
const BASE_URL = HTTP_REQUEST_URL+'/api';

export const questionApi = {
  // 获取问题列表
  getQuestions: () => {
	return request.get('question/get').then(res =>{
		return new Promise((resolve, reject) => {
		  if (res.status == 200) {
		    resolve(res.data);
		  } else {
		    reject(new Error(`获取问题失败: ${res.data.msg || '未知错误'}`));
		  }
		});
	});  
  },
  // 提交答案
  postTimu: (answers) => {
	  return request.post('question/save',{value:JSON.stringify(answers)});
  }
};